<!DOCTYPE html>
<html><head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
        
    <title>android - Load local html in WebView? - Stack Overflow</title>
    <link rel="shortcut icon" href="http://cdn.sstatic.net/stackoverflow/img/favicon.ico">
    <link rel="apple-touch-icon image_src" href="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
    <link rel="search" type="application/opensearchdescription+xml" title="Stack Overflow" href="http://stackoverflow.com/opensearch.xml">
    
    <script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/adzerk1_2_4_43adzerk2_2_17_45adzerk3_2_4_44" async="" type="text/javascript"></script><script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/ga.js" async="" type="text/javascript"></script><script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/quant.js" async="" type="text/javascript"></script><script type="text/javascript" src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/jquery.js"></script>
    <script type="text/javascript" src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/stub.js"></script>
    <link rel="stylesheet" type="text/css" href="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/all.css">
    
    <link rel="canonical" href="http://stackoverflow.com/questions/4543349/load-local-html-in-webview">
    <link rel="alternate" type="application/atom+xml" title="Feed for question 'Load local html in WebView?'" href="http://stackoverflow.com/feeds/question/4543349">
    <script type="text/javascript">
        
        StackExchange.ready(function () {
            StackExchange.using("postValidation", function () {
                StackExchange.postValidation.initOnBlurAndSubmit($('#post-form'), 2, 'answer');
            });

            
            StackExchange.question.init({showAnswerHelp:true,totalCommentCount:0,shownCommentCount:0,highlightColor:'#F4A83D',backgroundColor:'#FFF',questionId:4543349});

            styleCode();

                StackExchange.realtime.subscribeToQuestion('1', '4543349');
            
                    });
    </script>


    <script type="text/javascript">
        StackExchange.init({"stackAuthUrl":"https://stackauth.com","serverTime":1377527824,"styleCode":true,"enableUserHovercards":true,"site":{"name":"Stack Overflow","description":"Q&A for professional and enthusiast programmers","isNoticesTabEnabled":true,"recaptchaPublicKey":"6LdchgIAAAAAAJwGpIzRQSOFaO0pU6s44Xt8aTwc","enableSocialMediaInSharePopup":true},"user":{"fkey":"2d62bf1a26212d8884710cd59cc1a9bb","isAnonymous":true}});
        StackExchange.using.setCacheBreakers({"js/prettify-full.js":"6c261bebf56a","js/moderator.js":"ed7a8238b2f8","js/full-anon.js":"5f9bf5810297","js/full.js":"027ac5ea264e","js/wmd.js":"cff10cca4fd9","js/third-party/jquery.autocomplete.min.js":"e5f01e97f7c3","js/mobile.js":"7da2df1c9caf","js/help.js":"6e6623243cf6","js/tageditor.js":"450c9e8426fc","js/tageditornew.js":"b6c68ad4c7dd","js/inline-tag-editing.js":"8e84e8a137f7","js/revisions.js":"d3e781ee5528","js/review.js":"947758ba83ea","js/tagsuggestions.js":"aa48ef6154df","js/post-validation.js":"bb996020492a","js/explore-qlist.js":"1c5bbd79b562","js/events.js":"27a33f0b2cad"});
        
    </script>
    <script type="text/javascript">
        StackExchange.using("gps", function() {
             StackExchange.gps.init(true);
        });
    </script>
    
        <script type="text/javascript">
            StackExchange.ready(function () {
                $('#nav-tour').click(function () {
                    StackExchange.using("gps", function() {
                        StackExchange.gps.track("aboutpage.click", { aboutclick_location: "headermain" }, true);
                    });
                });
            });
        </script>
<script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/full-anon.js" type="text/javascript" async=""></script><script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/post-validation.js" type="text/javascript" async=""></script><script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/prettify-full.js" type="text/javascript" async=""></script><script src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/adFeedback.js" type="text/javascript"></script><link href="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/adFeedback.css" rel="stylesheet"></head>
<body class="question-page">
    <noscript><div id="noscript-padding"></div></noscript>
    <div id="notify-container"></div>
    <div id="overlay-header"></div>
    <div id="custom-header"></div>

    <div class="container">
        <div id="header" class="headeranon">
            <div id="portalLink">
                <a class="genu" onclick="StackExchange.ready(function(){genuwine.click();});return false;">Stack Exchange</a>
            </div>
            <div id="topbar">
                <div id="hlinks">
                    
<span id="hlinks-user"></span>
<span id="hlinks-nav">                        <a href="http://stackoverflow.com/users/login?returnurl=%2fquestions%2f4543349%2fload-local-html-in-webview">sign up</a>

 <span class="lsep">|</span>
                    <a href="http://stackoverflow.com/users/login?returnurl=%2fquestions%2f4543349%2fload-local-html-in-webview">log in</a>

 <span class="lsep">|</span>
                    <a href="http://careers.stackoverflow.com/">careers 2.0</a>

 <span class="lsep">|</span>
</span>
<span id="hlinks-custom"></span>
                </div>
                <div id="hsearch">
                    <form id="search" action="/search" method="get" autocomplete="off">
                        <div>
                            <input autocomplete="off" name="q" class="textbox" placeholder="search" tabindex="1" maxlength="240" size="28" type="text">
                        </div>
                    </form>
                </div>
            </div>
            <br class="cbt">
            <div id="hlogo">
                <a href="http://stackoverflow.com/">
                    Stack Overflow
                </a>
            </div>
            <div id="hmenus">
                <div class="nav mainnavs mainnavsanon">
                    <ul>
                            <li class="youarehere"><a id="nav-questions" href="http://stackoverflow.com/questions">Questions</a></li>
                            <li><a id="nav-tags" href="http://stackoverflow.com/tags">Tags</a></li>
                            <li><a id="nav-tour" href="http://stackoverflow.com/about">Tour</a></li>
                            <li><a id="nav-users" href="http://stackoverflow.com/users">Users</a></li>
                    </ul>
                </div>
                <div class="nav askquestion">
                    <ul>
                        <li>
                            <a id="nav-askquestion" href="http://stackoverflow.com/questions/ask">Ask Question</a>
                        </li>
                    </ul>
                </div>
            </div>
        </div>
        



        <div id="content">
            

<div itemscope="" itemtype="http://schema.org/Article">
<link itemprop="image" href="http://cdn.sstatic.net/stackoverflow/img/apple-touch-icon.png">
<!--googleoff: all-->
<div id="herobox-mini">
    <div id="hero-content">
        <span id="controls">
            <a href="http://stackoverflow.com/about" id="tell-me-more" class="button">Tell me more</a>
            <span id="close"><a title="click to dismiss">×</a></span>
        </span>
        <div id="blurb">
            Stack Overflow is a question and answer site for 
professional and enthusiast programmers. It's 100% free, no registration
 required.
        </div>        
    </div>
    <script>
        $('#tell-me-more').click(function () {
            var clickSource = $("body").attr("class") + '-mini';
            if ($("body").hasClass("questions-page")) {
                clickSource = 'questionpagemini';
            }
            if ($("body").hasClass("home-page")) {
                clickSource = 'homepagemini';
            }

            StackExchange.using("gps", function () {
                StackExchange.gps.track("aboutpage.click", { aboutclick_location: clickSource } , true);
            });
        });
        $('#herobox-mini #close').click(function () {
            StackExchange.using("gps", function () {
                StackExchange.gps.track("hero.action", { hero_action_type: "close" }, true);
            });
            $.cookie("hero", "none", { path: "/" });
            var $hero = $("#herobox-mini");
            $hero.slideUp('fast', function () { $hero.remove(); });
            return false;
        });
    </script>
</div>
<!--googleon: all-->
<div id="question-header">
    <h1 itemprop="name"><a href="http://stackoverflow.com/questions/4543349/load-local-html-in-webview" class="question-hyperlink">Load local html in WebView?</a></h1>
</div>
<div id="mainbar">

    

<div class="question" data-questionid="4543349" id="question">
    
                <div class="everyonelovesstackoverflow adzerk-vote" id="adzerk1"><a href="http://engine.adzerk.net/r?e=eyJhdiI6NDkzLCJhdCI6NCwiY20iOjQwNDg4LCJjaCI6MTE3OCwiY3IiOjk0OTc4LCJkaSI6IjNhMWFjMGQxNjIwMDRkZTJhMjJkMjgxM2E0NDVhYTViIiwiZG0iOjEsImZjIjoxNDQ1NzksImZsIjo3MTMwMSwia3ciOiJhbmRyb2lkLHdlYnZpZXciLCJtayI6ImFuZHJvaWQiLCJudyI6MjIsInJmIjoiaHR0cDovL3d3dy5nb29nbGUuY29tLnZuL3VybD9zYT10IiwicnYiOjMuNzUsInByIjo3NjUsInN0Ijo4Mjc3LCJ6biI6NDMsInVyIjoiaHR0cDovL2RldmVsb3Blci5hdHQuY29tL2h0bWxQYWNrYWdlcy9BVFRfSW5BcHBNZXNzYWdlX0FQSS9pbmRleC5odG1sP3NpZD01NjMzOCZ1dG1fc291cmNlPXN0YWNrb3ZlcmZsb3cmdXRtX21lZGl1bT1iYW5uZXImdXRtX2NhbXBhaWduPWluYXBwIn0&amp;s=bdqFWgp4WET707G7xTuYHWx3MUc" rel="nofollow" target="_blank" title=""><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/b7b09247812a4fd1a7c940ac9af90c9c.png" title="" alt="" border="0" height="90" width="728"></a><div class="adzerk-vote-controls" style="display: none;"><div class="adzerk-vote-option adzerk-vote-up"><div class="adzerk-vote-icon"></div></div><div class="adzerk-vote-option adzerk-vote-down"><div class="adzerk-vote-icon"></div></div></div><div class="adzerk-vote-survey" style="display:none;"><form><span>No problem. We won't show you that ad again. Why didn't you like it?</span><ul><li><label><input value="12" name="downvoteReason" type="radio">Uninteresting</label></li><li><label><input value="13" name="downvoteReason" type="radio">Misleading</label></li><li><label><input value="14" name="downvoteReason" type="radio">Offensive</label></li><li><label><input value="15" name="downvoteReason" type="radio">Repetitive</label></li></ul><a href="#" class="adzerk-vote-cancel">Oops! I didn't mean to do this.</a></form></div><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/i_003.gif" border="0" height="0px" width="0px"></div>


    <table>
        <tbody><tr>
            <td class="votecell">
                

<div class="vote">
    <input name="_id_" value="4543349" type="hidden">
    <a class="vote-up-off" title="This question shows research effort; it is useful and clear">up vote</a>
    <span class="vote-count-post ">14</span>
    <a class="vote-down-off" title="This question does not show any research effort; it is unclear or not useful">down vote</a>
    
    <a class="star-off" href="#" title="This is a favorite question (click again to undo)">favorite</a>
    <div class="favoritecount"><b>4</b></div>   

</div>

            </td>
            
<td class="postcell">
<div>
    <div class="post-text" itemprop="description">

        <p>I want to load a local html into a WebView WITHOUT using 
"file:///" because that does not allow cookies. Is there a way to use 
something like "localhost" ?</p>

<p>Secondly, I could not find a way to enable cookies in the getSettings(). Because cookies are not allowed while using "file:///".</p>

    </div>
    <div class="post-taglist">
        <a href="http://stackoverflow.com/questions/tagged/android" class="post-tag" title="show questions tagged 'android'" rel="tag"><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/tKsDb.png" alt="" class="sponsor-tag-img" height="16" width="18">android</a> <a href="http://stackoverflow.com/questions/tagged/webview" class="post-tag" title="show questions tagged 'webview'" rel="tag">webview</a> 
    </div>
    <table class="fw">
    <tbody><tr>
    <td class="vt">











<div class="post-menu"><a href="http://stackoverflow.com/q/4543349" title="short permalink to this question" class="short-link" id="link-post-4543349">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/4543349/edit" class="suggest-edit-post" title="">improve this question</a></div>        
    </td>
    <td class="post-signature owner">
        

    <div class="user-info ">
        <div class="user-action-time">
            

                    asked <span title="2010-12-28 02:55:59Z" class="relativetime">Dec 28 '10 at 2:55</span>
        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/488407/jash-sayani"><div class=""><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/509508b90e7bbd6131e467540e96ad76.jpg" alt="" height="32" width="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/488407/jash-sayani">Jash Sayani</a><br>
            <span class="reputation-score" title="reputation score" dir="ltr">151</span><span title="1 gold badge"><span class="badge1"></span><span class="badgecount">1</span></span><span title="2 silver badges"><span class="badge2"></span><span class="badgecount">2</span></span><span title="10 bronze badges"><span class="badge3"></span><span class="badgecount">10</span></span>
        </div>
    </div>

    </td>
    </tr>
    </tbody></table>
</div>
</td>
        </tr>


<tr>
<td class="votecell"></td>
<td>
    <div id="comments-4543349" class="comments dno">
        <table>
        <tbody>
        
            <tr><td></td><td></td></tr>
        
        </tbody>
    
        </table>
    </div>
    <a id="comments-link-4543349" class="comments-link" href="#"></a>
</td>
</tr>            </tbody></table>    
</div>


    <div id="answers">

    <a name="tab-top"></a>
    <div id="answers-header">
        <div class="subheader answers-subheader">
            <h2>
                    3 Answers
            </h2>
            <div id="tabs">
                <a href="http://stackoverflow.com/questions/4543349/load-local-html-in-webview?answertab=active#tab-top" title="Answers with the latest activity first">active</a>
<a href="http://stackoverflow.com/questions/4543349/load-local-html-in-webview?answertab=oldest#tab-top" title="Answers in the order they were provided">oldest</a>
<a class="youarehere" href="http://stackoverflow.com/questions/4543349/load-local-html-in-webview?answertab=votes#tab-top" title="Answers with the highest score first">votes</a>

            </div>
        </div>    
    </div>    




  
<a name="4543485"></a>
<div id="answer-4543485" class="answer" data-answerid="4543485">
    <table>
        <tbody><tr>
            <td class="votecell">
                

<div class="vote">
    <input name="_id_" value="4543485" type="hidden">
    <a class="vote-up-off" title="This answer is useful">up vote</a>
    <span class="vote-count-post ">35</span>
    <a class="vote-down-off" title="This answer is not useful">down vote</a>
    


</div>

            </td>
            


<td class="answercell">
    <div class="post-text"><p>You can only do something like that. This solution load HTML from a String variable:</p>

<pre style="" class="default prettyprint prettyprinted"><code><span class="typ">String</span><span class="pln"> html </span><span class="pun">=</span><span class="pln"> </span><span class="str">"&lt;html&gt;&lt;body&gt;Hello, World!&lt;/body&gt;&lt;/html&gt;"</span><span class="pun">;</span><span class="pln">
</span><span class="typ">String</span><span class="pln"> mime </span><span class="pun">=</span><span class="pln"> </span><span class="str">"text/html"</span><span class="pun">;</span><span class="pln">
</span><span class="typ">String</span><span class="pln"> encoding </span><span class="pun">=</span><span class="pln"> </span><span class="str">"utf-8"</span><span class="pun">;</span><span class="pln">

</span><span class="typ">WebView</span><span class="pln"> myWebView </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="typ">WebView</span><span class="pun">)</span><span class="kwd">this</span><span class="pun">.</span><span class="pln">findViewById</span><span class="pun">(</span><span class="pln">R</span><span class="pun">.</span><span class="pln">id</span><span class="pun">.</span><span class="pln">myWebView</span><span class="pun">);</span><span class="pln">
myWebView</span><span class="pun">.</span><span class="pln">getSettings</span><span class="pun">().</span><span class="pln">setJavaScriptEnabled</span><span class="pun">(</span><span class="kwd">true</span><span class="pun">);</span><span class="pln">
myWebView</span><span class="pun">.</span><span class="pln">loadDataWithBaseURL</span><span class="pun">(</span><span class="kwd">null</span><span class="pun">,</span><span class="pln"> html</span><span class="pun">,</span><span class="pln"> mime</span><span class="pun">,</span><span class="pln"> encoding</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">);</span></code></pre>

<p>EDIT: try to set the first parameter (the baseURL) of <a href="http://developer.android.com/reference/android/webkit/WebView.html#loadDataWithBaseURL%28java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String,%20java.lang.String%29">loadDataWithBaseURL()</a> for your needs</p>
</div>
    <table class="fw">
    <tbody><tr>
    <td class="vt">











<div class="post-menu"><a href="http://stackoverflow.com/a/4543485" title="short permalink to this answer" class="short-link" id="link-post-4543485">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/4543485/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>
    <td class="post-signature" align="right">


    <div class="user-info ">
        <div class="user-action-time">
            

            <a href="http://stackoverflow.com/posts/4543485/revisions" title="show all edits to this post">edited <span title="2010-12-28 03:41:48Z" class="relativetime">Dec 28 '10 at 3:41</span></a>

        </div>
        <div class="user-gravatar32">
            
        </div>
        <div class="user-details">
            <br>
            
        </div>
    </div>
    </td>
            


    <td class="post-signature" align="right">   
       

    

    <div class="user-info user-hover">
        <div class="user-action-time">
            

                        answered <span title="2010-12-28 03:36:19Z" class="relativetime">Dec 28 '10 at 3:36</span>
        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/432219/marcel-j-kloubert"><div class=""><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/5d9fc81d63d3d8ca9e510159f0372fb7.jpg" alt="" height="32" width="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/432219/marcel-j-kloubert">Marcel J. Kloubert</a><br>
            <span class="reputation-score" title="reputation score" dir="ltr">2,980</span><span title="6 silver badges"><span class="badge2"></span><span class="badgecount">6</span></span><span title="21 bronze badges"><span class="badge3"></span><span class="badgecount">21</span></span>
        </div>
    </div>

    </td>
    </tr>
    </tbody></table>
</td>
        </tr>



<tr>
<td class="votecell"></td>
<td>
    <div id="comments-4543485" class="comments">
        <table>
        <tbody>
                    
    <tr id="comment-19530300" class="comment" data-commentid="19530300">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">@user113215:
 but you have read the documentation link for loadDataWithBaseURL() 
method, haven't you?? the 4th argument is called "encoding", so i called
 the variable "encoding" ... as you can see here it is used for the 
output charset: <a href="http://myexperiencewithandroid.blogspot.de/2011/09/android-loaddatawithbaseurl.html" rel="nofollow">myexperiencewithandroid.blogspot.de/2011/09/…</a> ... you should also read this: <a href="http://en.wikipedia.org/wiki/Character_encoding" rel="nofollow">en.wikipedia.org/wiki/Character_encoding</a> ... so i do not see your problem.</span> –&nbsp;<a href="http://stackoverflow.com/users/432219/marcel-j-kloubert" title="2980 reputation" class="comment-user">Marcel J. Kloubert</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment19530300_4543485"><span title="2013-01-01 18:11:20Z" class="relativetime-clean">Jan 1 at 18:11</span></a></span><span class="edited-yes" title="this comment was edited 2 times"></span></div></td>
    </tr>
            
    <tr id="comment-19546390" class="comment" data-commentid="19546390">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">but no 
(data) scheme is used here in the example, only local HTML data is 
loaded that should be displayed in the WebView: "If the base URL uses 
the data scheme, this method is equivalent to calling loadData() and the
 historyUrl is ignored."</span> –&nbsp;<a href="http://stackoverflow.com/users/432219/marcel-j-kloubert" title="2980 reputation" class="comment-user">Marcel J. Kloubert</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment19546390_4543485"><span title="2013-01-02 11:54:38Z" class="relativetime-clean">Jan 2 at 11:54</span></a></span><span class="edited-yes" title="this comment was edited"></span></div></td>
    </tr>
            
    <tr id="comment-19566040" class="comment" data-commentid="19566040">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">Ah, this is confusing. I investigated the Android source and you are correct. Using this method with the <code>data:</code> URL scheme results in a call to <code>nativeLoadUrl()</code> (where <code>encoding</code> denotes either Base64 or URL encoding), but otherwise this method results in a call to <code>nativeLoadData()</code> (where <code>encoding</code> denotes character set).</span> –&nbsp;<a href="http://stackoverflow.com/users/687315/user113215" title="2761 reputation" class="comment-user">user113215</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment19566040_4543485"><span title="2013-01-03 01:48:56Z" class="relativetime-clean">Jan 3 at 1:48</span></a></span></div></td>
    </tr>

        </tbody>
    
        </table>
    </div>
    <a id="comments-link-4543485" class="comments-link" href="#"></a>
</td>
</tr>
    </tbody></table>
</div>
            <div class="everyonelovesstackoverflow adzerk-vote" id="adzerk3"><a href="http://engine.adzerk.net/r?e=eyJhdiI6ODExOCwiYXQiOjQsImNtIjo0NDcyNywiY2giOjExNzgsImNyIjoxMjE0NjQsImRpIjoiMWFmMzA3MGE0YjJkNDJmYmFlODZiYjZiZDIzNTA1MjMiLCJkbSI6MSwiZmMiOjE2NTA3OCwiZmwiOjc5ODk5LCJrdyI6ImFuZHJvaWQsd2VidmlldyIsIm53IjoyMiwicmYiOiJodHRwOi8vd3d3Lmdvb2dsZS5jb20udm4vdXJsP3NhPXQiLCJydiI6NSwicHIiOjE1NjcsInN0Ijo4Mjc3LCJ6biI6NDQsInVyIjoiaHR0cDovL3NhbXN1bmdkZXZjb24uY29tLz91dG1fc291cmNlPXN0YWNrJnV0bV9tZWRpdW09YmFubmVyJnV0bV9jb250ZW50PTcyOHg5MCZ1dG1fY2FtcGFpZ249ZGV2Y29uIn0&amp;s=mGjcYgZXX_p_Wv7yKOhETF4APO8" rel="nofollow" target="_blank" title=""><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/5303cfd04cda4688be2f7176868995a2.jpg" title="" alt="" border="0" height="90" width="728"></a><div class="adzerk-vote-controls" style="display:none;"><div class="adzerk-vote-option adzerk-vote-up"><div class="adzerk-vote-icon"></div></div><div class="adzerk-vote-option adzerk-vote-down"><div class="adzerk-vote-icon"></div></div></div><div class="adzerk-vote-survey" style="display:none;"><form><span>No problem. We won't show you that ad again. Why didn't you like it?</span><ul><li><label><input value="12" name="downvoteReason" type="radio">Uninteresting</label></li><li><label><input value="13" name="downvoteReason" type="radio">Misleading</label></li><li><label><input value="14" name="downvoteReason" type="radio">Offensive</label></li><li><label><input value="15" name="downvoteReason" type="radio">Repetitive</label></li></ul><a href="#" class="adzerk-vote-cancel">Oops! I didn't mean to do this.</a></form></div><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/i_002.gif" border="0" height="0px" width="0px"></div>



  
<a name="8816922"></a>
<div id="answer-8816922" class="answer" data-answerid="8816922">
    <table>
        <tbody><tr>
            <td class="votecell">
                

<div class="vote">
    <input name="_id_" value="8816922" type="hidden">
    <a class="vote-up-off" title="This answer is useful">up vote</a>
    <span class="vote-count-post ">5</span>
    <a class="vote-down-off" title="This answer is not useful">down vote</a>
    


</div>

            </td>
            


<td class="answercell">
    <div class="post-text"><pre style="" class="default prettyprint prettyprinted"><code><span class="kwd">public</span><span class="pln"> </span><span class="kwd">void</span><span class="pln"> onCreate</span><span class="pun">(</span><span class="typ">Bundle</span><span class="pln"> savedInstanceState</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="kwd">super</span><span class="pun">.</span><span class="pln">onCreate</span><span class="pun">(</span><span class="pln">savedInstanceState</span><span class="pun">);</span><span class="pln">
        setContentView</span><span class="pun">(</span><span class="pln">R</span><span class="pun">.</span><span class="pln">layout</span><span class="pun">.</span><span class="pln">main</span><span class="pun">);</span><span class="pln">

        </span><span class="typ">WebView</span><span class="pln"> view </span><span class="pun">=</span><span class="pln"> </span><span class="pun">(</span><span class="typ">WebView</span><span class="pun">)</span><span class="pln"> findViewById</span><span class="pun">(</span><span class="pln">R</span><span class="pun">.</span><span class="pln">id</span><span class="pun">.</span><span class="pln">webView1</span><span class="pun">);</span><span class="pln">
        </span><span class="kwd">try</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
        </span><span class="typ">InputStream</span><span class="pln"> input </span><span class="pun">=</span><span class="pln"> getResources</span><span class="pun">().</span><span class="pln">openRawResource</span><span class="pun">(</span><span class="pln">R</span><span class="pun">.</span><span class="pln">raw</span><span class="pun">.</span><span class="pln">lights</span><span class="pun">);</span><span class="pln">
        </span><span class="typ">Reader</span><span class="pln"> </span><span class="kwd">is</span><span class="pln"> </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">BufferedReader</span><span class="pun">(</span><span class="pln">
                </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">InputStreamReader</span><span class="pun">(</span><span class="pln">input</span><span class="pun">,</span><span class="pln"> </span><span class="str">"windows-1252"</span><span class="pun">));</span><span class="pln">


            </span><span class="com">//InputStream input = getAssets().open("ws.TXT");</span><span class="pln">
            </span><span class="kwd">int</span><span class="pln"> size</span><span class="pun">;</span><span class="pln">
            size </span><span class="pun">=</span><span class="pln"> input</span><span class="pun">.</span><span class="pln">available</span><span class="pun">();</span><span class="pln">
            </span><span class="kwd">byte</span><span class="pun">[]</span><span class="pln"> buffer </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="kwd">byte</span><span class="pun">[</span><span class="pln">size</span><span class="pun">];</span><span class="pln">
            input</span><span class="pun">.</span><span class="pln">read</span><span class="pun">(</span><span class="pln">buffer</span><span class="pun">);</span><span class="pln">
            input</span><span class="pun">.</span><span class="pln">close</span><span class="pun">();</span><span class="pln">
            </span><span class="com">// byte buffer into a string</span><span class="pln">
            javascrips </span><span class="pun">=</span><span class="pln"> </span><span class="kwd">new</span><span class="pln"> </span><span class="typ">String</span><span class="pun">(</span><span class="pln">buffer</span><span class="pun">);</span><span class="pln">
        </span><span class="pun">}</span><span class="pln"> </span><span class="kwd">catch</span><span class="pln"> </span><span class="pun">(</span><span class="typ">IOException</span><span class="pln"> e</span><span class="pun">)</span><span class="pln"> </span><span class="pun">{</span><span class="pln">
            </span><span class="com">// TODO Auto-generated catch block</span><span class="pln">
            e</span><span class="pun">.</span><span class="pln">printStackTrace</span><span class="pun">();</span><span class="pln">
        </span><span class="pun">}</span><span class="pln">
        </span><span class="com">// String html = readFile(is);</span><span class="pln">

        view</span><span class="pun">.</span><span class="pln">loadDataWithBaseURL</span><span class="pun">(</span><span class="str">"file:///android_res/raw/"</span><span class="pun">,</span><span class="pln"> javascrips</span><span class="pun">,</span><span class="pln"> </span><span class="str">"text/html"</span><span class="pun">,</span><span class="pln">
                </span><span class="str">"UTF-8"</span><span class="pun">,</span><span class="pln"> </span><span class="kwd">null</span><span class="pun">);</span><span class="pln">
    </span><span class="pun">}</span></code></pre>
</div>
    <table class="fw">
    <tbody><tr>
    <td class="vt">











<div class="post-menu"><a href="http://stackoverflow.com/a/8816922" title="short permalink to this answer" class="short-link" id="link-post-8816922">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/8816922/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>
            


    <td class="post-signature" align="right">   
       

    

    <div class="user-info ">
        <div class="user-action-time">
            

                        answered <span title="2012-01-11 09:29:01Z" class="relativetime">Jan 11 '12 at 9:29</span>
        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/905732/viren"><div class=""><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/1df06b57a031852e61565f851ff25a14.png" alt="" height="32" width="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/905732/viren">viren</a><br>
            <span class="reputation-score" title="reputation score" dir="ltr">188</span><span title="2 silver badges"><span class="badge2"></span><span class="badgecount">2</span></span><span title="9 bronze badges"><span class="badge3"></span><span class="badgecount">9</span></span>
        </div>
    </div>

    </td>
    </tr>
    </tbody></table>
</td>
        </tr>



<tr>
<td class="votecell"></td>
<td>
    <div id="comments-8816922" class="comments">
        <table>
        <tbody>
                    
    <tr id="comment-14324552" class="comment" data-commentid="14324552">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">Nice snippet of code, just missing the definition ` String javascrips;`.</span> –&nbsp;<a href="http://stackoverflow.com/users/556600/1ka" title="530 reputation" class="comment-user">1ka</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment14324552_8816922"><span title="2012-06-10 15:46:18Z" class="relativetime-clean">Jun 10 '12 at 15:46</span></a></span><span class="edited-yes" title="this comment was edited"></span></div></td>
    </tr>
            
    <tr id="comment-16527383" class="comment" data-commentid="16527383">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">javascrips is any html files text. like &lt;html&gt;&lt;body&gt; ... &lt;/html&gt;</span> –&nbsp;<a href="http://stackoverflow.com/users/905732/viren" title="188 reputation" class="comment-user">viren</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment16527383_8816922"><span title="2012-09-07 10:32:27Z" class="relativetime-clean">Sep 7 '12 at 10:32</span></a></span><span class="edited-yes" title="this comment was edited"></span></div></td>
    </tr>
            
    <tr id="comment-16996259" class="comment" data-commentid="16996259">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">I'm taking this the extra step. webview.loadUrl("file:///android_res/raw/help.html");</span> –&nbsp;<a href="http://stackoverflow.com/users/446843/wjl" title="1266 reputation" class="comment-user">wjl</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment16996259_8816922"><span title="2012-09-26 18:53:31Z" class="relativetime-clean">Sep 26 '12 at 18:53</span></a></span></div></td>
    </tr>
            
    <tr id="comment-17102222" class="comment" data-commentid="17102222">
        <td></td>
        <td class="comment-text"><div><span class="comment-copy">view.loadDataWithBaseURL("file:///android_res/raw/"
 is provide local images path, where webpage create from text 
(javascrips string) and image required path where it located.</span> –&nbsp;<a href="http://stackoverflow.com/users/905732/viren" title="188 reputation" class="comment-user">viren</a> <span class="comment-date" dir="ltr"><a class="comment-link" href="#comment17102222_8816922"><span title="2012-10-01 12:40:45Z" class="relativetime-clean">Oct 1 '12 at 12:40</span></a></span></div></td>
    </tr>

        </tbody>
    
        </table>
    </div>
    <a id="comments-link-8816922" class="comments-link" href="#"></a>
</td>
</tr>
    </tbody></table>
</div>

  
<a name="4543567"></a>
<div id="answer-4543567" class="answer" data-answerid="4543567">
    <table>
        <tbody><tr>
            <td class="votecell">
                

<div class="vote">
    <input name="_id_" value="4543567" type="hidden">
    <a class="vote-up-off" title="This answer is useful">up vote</a>
    <span class="vote-count-post ">3</span>
    <a class="vote-down-off" title="This answer is not useful">down vote</a>
    


</div>

            </td>
            


<td class="answercell">
    <div class="post-text"><p>If you want to access <code>localhost</code> through the Android, you need to use <code>http://10.0.2.2:35643/</code> where 35643 is the specific port, if needed.</p>
</div>
    <table class="fw">
    <tbody><tr>
    <td class="vt">











<div class="post-menu"><a href="http://stackoverflow.com/a/4543567" title="short permalink to this answer" class="short-link" id="link-post-4543567">share</a><span class="lsep">|</span><a href="http://stackoverflow.com/posts/4543567/edit" class="suggest-edit-post" title="">improve this answer</a></div>                    </td>
            


    <td class="post-signature" align="right">   
       

    

    <div class="user-info ">
        <div class="user-action-time">
            

                        answered <span title="2010-12-28 04:02:11Z" class="relativetime">Dec 28 '10 at 4:02</span>
        </div>
        <div class="user-gravatar32">
            <a href="http://stackoverflow.com/users/456916/sahhhm"><div class=""><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/7d07c54d70584d530ece9ff128418a9d.png" alt="" height="32" width="32"></div></a>
        </div>
        <div class="user-details">
            <a href="http://stackoverflow.com/users/456916/sahhhm">sahhhm</a><br>
            <span class="reputation-score" title="reputation score" dir="ltr">2,217</span><span title="8 silver badges"><span class="badge2"></span><span class="badgecount">8</span></span><span title="15 bronze badges"><span class="badge3"></span><span class="badgecount">15</span></span>
        </div>
    </div>

    </td>
    </tr>
    </tbody></table>
</td>
        </tr>



<tr>
<td class="votecell"></td>
<td>
    <div id="comments-4543567" class="comments dno">
        <table>
        <tbody>
        
            <tr><td></td><td></td></tr>
        
        </tbody>
    
        </table>
    </div>
    <a id="comments-link-4543567" class="comments-link" href="#"></a>
</td>
</tr>
    </tbody></table>
</div>
    <a name="new-answer"></a>
    <form id="post-form" action="/questions/4543349/answer/submit" method="post" class="post-form">
        <input id="post-id" value="4543349" type="hidden">
        <h2 class="space">Your Answer</h2>



    
<script type="text/javascript">
    StackExchange.ready(function() {
        initTagRenderer("".split(" "), "".split(" "));
         
        prepareEditor({
            heartbeatType: 'answer',
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
        });
        

    });  
</script>


<div id="post-editor" class="post-editor">

    <div style="position: relative;">     
        <div class="wmd-container">
            <div id="wmd-button-bar" class="wmd-button-bar"><ul id="wmd-button-row" class="wmd-button-row"><li style="left: 0px;" class="wmd-button" id="wmd-bold-button"><span style="background-position: 0px -20px;"></span></li><li style="left: 25px;" class="wmd-button" id="wmd-italic-button"><span style="background-position: -20px -20px;"></span></li><li style="left: 50px;" class="wmd-spacer" id="wmd-spacer1"><span style="background-position: -40px -20px;"></span></li><li style="left: 75px;" class="wmd-button" id="wmd-link-button"><span style="background-position: -40px -20px;"></span></li><li style="left: 100px;" class="wmd-button" id="wmd-quote-button"><span style="background-position: -60px -20px;"></span></li><li style="left: 125px;" class="wmd-button" id="wmd-code-button"><span style="background-position: -80px -20px;"></span></li><li style="left: 150px;" class="wmd-button" id="wmd-image-button"><span style="background-position: -100px -20px;"></span></li><li style="left: 175px;" class="wmd-spacer" id="wmd-spacer2"><span style="background-position: -120px -20px;"></span></li><li style="left: 200px;" class="wmd-button" id="wmd-olist-button"><span style="background-position: -120px -20px;"></span></li><li style="left: 225px;" class="wmd-button" id="wmd-ulist-button"><span style="background-position: -140px -20px;"></span></li><li style="left: 250px;" class="wmd-button" id="wmd-heading-button"><span style="background-position: -160px -20px;"></span></li><li style="left: 275px;" class="wmd-button" id="wmd-hr-button"><span style="background-position: -180px -20px;"></span></li><li style="left: 300px;" class="wmd-spacer" id="wmd-spacer3"><span style="background-position: -200px -20px;"></span></li><li style="left: 325px;" class="wmd-button" id="wmd-undo-button"><span style="background-position: -200px -20px;"></span></li><li style="left: 350px;" class="wmd-button" id="wmd-redo-button"><span style="background-position: -220px -20px;"></span></li></ul></div>
            <textarea id="wmd-input" class="wmd-input" name="post-text" cols="92" rows="15" tabindex="101" data-min-length=""></textarea>
        </div>
    </div>

    <div class="fl" style="margin-top: 8px; height:24px;">&nbsp;</div>
    <div id="draft-saved" class="draft-saved community-option fl" style="margin-top: 8px; height:24px; display:none;">draft saved</div>

    <div id="draft-discarded" class="draft-discarded community-option fl" style="margin-top: 8px; height:24px; display:none;">draft discarded</div>



    <div id="wmd-preview" class="wmd-preview"></div>
    <div></div>
    <div class="edit-block">
        <input id="fkey" name="fkey" value="2d62bf1a26212d8884710cd59cc1a9bb" type="hidden">
        <input id="author" name="author" type="text">
    </div>
</div>
        <div style="position: relative;"> 
            <div class="form-item new-post-login">
        
                <div class="new-login-form">
                    <div class="new-login-left">
                        <h3>Sign up or <a id="login-link" href="http://stackoverflow.com/users/login?returnurl=%2fquestions%2f4543349%2fload-local-html-in-webview%23new-answer">login</a></h3>
                        <script type="text/javascript">
                            StackExchange.ready(function () {
                                StackExchange.helpers.onClickDraftSave('#login-link');
                            });
                        </script>
                        <div class="preferred-login google-login">
                            <p><span class="icon"></span><span>Sign up using Google</span></p>
                        </div>
                        <div class="preferred-login facebook-login">
                            <p><span class="icon"></span><span>Sign up using Facebook</span></p>
                        </div>
                        <div class="preferred-login stackexchange-login">
                            <p><span class="icon"></span><span>Sign up using Stack Exchange</span></p>
                        </div>
                    </div>
                    <input name="manual-openid" class="manual-openid" type="hidden">
                    <input name="use-facebook" class="use-facebook" value="false" type="hidden">
                    <input class="submit-openid" value="Submit" style="display:none" type="button">
                    <div class="new-login-right">
                                <h3>Post as a guest</h3>
    <div class="form-item">
        <table>
        <tbody><tr>
                    <script type="text/javascript">
                StackExchange.ready(function () {
                    StackExchange.helpers.bindHelpOverlayEvents($('.vm input'));
                });
            </script>
            <td class="vm">
                <div>
                    <label for="display-name">Name</label>
                    <input id="display-name" name="display-name" size="30" maxlength="30" tabindex="105" type="text">
                </div>
                <div>
                    <label for="m-address">Email</label>
                    <input id="m-address" name="m-address" size="30" maxlength="100" tabindex="106" type="text">
                    <span class="edit-field-overlay">required, but not shown</span>
                </div>
            </td>
        </tr>
        </tbody></table>
    </div>

                    </div>
                </div>
            </div>
            <script type="text/javascript">
                StackExchange.ready(
                    function () {
                        StackExchange.openid.initPostLogin('.new-post-login', '%2fquestions%2f4543349%2fload-local-html-in-webview%23new-answer');
                    }
                );
            </script>
            <noscript>
                        <h3>Post as a guest</h3>
    <div class="form-item">
        <table>
        <tr>
                    <script type="text/javascript">
                StackExchange.ready(function () {
                    StackExchange.helpers.bindHelpOverlayEvents($('.vm input'));
                });
            </script>
            <td class="vm">
                <div>
                    <label for="display-name">Name</label>
                    <input id="display-name" name="display-name" type="text" size="30" maxlength="30" value="" tabindex="105">
                </div>
                <div>
                    <label for="m-address">Email</label>
                    <input id="m-address" name="m-address" type="text" size="30" maxlength="100" value="" tabindex="106">
                    <span class="edit-field-overlay">required, but not shown</span>
                </div>
            </td>
        </tr>
        </table>
    </div>

            </noscript>
        </div>
           
            <div class="form-submit cbt">
            <input id="submit-button" value="Post Your Answer" tabindex="110" type="submit">
            <a href="#" class="discard-answer dno">discard</a>

<p class="privacy-policy-agreement">
By posting your answer, you agree to the <a href="http://stackexchange.com/legal/privacy-policy" target="_blank">privacy policy</a> and <a href="http://stackexchange.com/legal/terms-of-service" target="_blank">terms of service</a>.</p>
<input name="legalLinksShown" value="1" type="hidden">        </div>
    </form>



        <h2 class="bottom-notice">
                Not the answer you're looking for? 
            Browse other questions tagged <a href="http://stackoverflow.com/questions/tagged/android" class="post-tag" title="show questions tagged 'android'" rel="tag"><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/tKsDb.png" alt="" class="sponsor-tag-img" height="16" width="18">android</a> <a href="http://stackoverflow.com/questions/tagged/webview" class="post-tag" title="show questions tagged 'webview'" rel="tag">webview</a> 
                or <a href="http://stackoverflow.com/questions/ask">ask your own question</a>.
        </h2>
</div>
</div>
<div id="sidebar" class="show-votes">
        <div class="module question-stats">
        <p class="label-key">tagged</p>
        <div class="tagged"><a href="http://stackoverflow.com/questions/tagged/android" class="post-tag" title="show questions tagged 'android'" rel="tag"><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/tKsDb.png" alt="" class="sponsor-tag-img" height="16" width="18">android</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">375072</span></span><br>
<a href="http://stackoverflow.com/questions/tagged/webview" class="post-tag" title="show questions tagged 'webview'" rel="tag">webview</a>&nbsp;<span class="item-multiplier"><span class="item-multiplier-x">×</span>&nbsp;<span class="item-multiplier-count">5608</span></span><br>
</div>
        <table id="qinfo">
            <tbody><tr>
                <td><p class="label-key">asked</p></td>
                <td style="padding-left:10px"><p class="label-key" title="2010-12-28 02:55:59Z"><b>2 years ago</b></p></td>
            </tr>
            <tr>
                <td><p class="label-key">viewed</p></td>

                <td style="padding-left:10px">
                    <p class="label-key">
                        <b>25749 times</b>
                    </p>
                </td>
            </tr>
            <tr>
                <td><p class="label-key">active</p></td>
                <td style="padding-left:10px"><p class="label-key"><b><a href="http://stackoverflow.com/questions/4543349/load-local-html-in-webview?lastactivity" class="lastactivity-link" title="2012-01-11 09:29:01Z">1 year ago</a></b></p></td>
            </tr>
        </tbody></table>
    </div>
    
<div class="module community-bulletin" data-tracker="cb=1">
    <h4>Community Bulletin</h4>
    <div class="related">
        <div class="spacer">
            <div class="bulletin-item-type"><a href="http://blog.stackoverflow.com/?cb=1" class="event-date" target="_blank">blog</a></div>
            <div class="bulletin-item-content">
                <a href="http://blog.stackoverflow.com/2013/08/introducing-gabe-the-smiling-community-manager/?cb=1" class="question-hyperlink" target="_blank">Introducing Gabe, The Smiling Community Manager</a>
            </div>
            <br class="cbt">
        </div>
    </div>
</div>    
                    <script type="text/javascript">
                    var scriptSrc = "http://engine.adzerk.net/z/8277/adzerk1_2_4_43,adzerk2_2_17_45,adzerk3_2_4_44?keywords=android,webview";
                    if (document.referrer) {
                        if (/\?/.test(scriptSrc))
                            scriptSrc += "&";
                        else
                            scriptSrc += "?";
                        scriptSrc += "xReferrer=" + document.referrer;
                    }
                    StackExchange.ready(function() {
                        var z = document.createElement("script");
                        z.type = "text/javascript";
                        z.async = "true";
                        z.src = scriptSrc;
                        var s = document.getElementsByTagName("script")[0];
                        s.parentNode.insertBefore(z, s);
                    });
                </script>
            <div class="everyonelovesstackoverflow adzerk-vote" id="adzerk2"><div id="careersadsdoublehigh" style="display:none;"></div><div class="adzerk-vote-controls" style="display:none;"><div class="adzerk-vote-option adzerk-vote-up"><div class="adzerk-vote-icon"></div></div><div class="adzerk-vote-option adzerk-vote-down"><div class="adzerk-vote-icon"></div></div></div><div class="adzerk-vote-survey" style="display:none;"><form><span>No problem. We won't show you that ad again. Why didn't you like it?</span><ul><li><label><input value="12" name="downvoteReason" type="radio">Uninteresting</label></li><li><label><input value="13" name="downvoteReason" type="radio">Misleading</label></li><li><label><input value="14" name="downvoteReason" type="radio">Offensive</label></li><li><label><input value="15" name="downvoteReason" type="radio">Repetitive</label></li></ul><a href="#" class="adzerk-vote-cancel">Oops! I didn't mean to do this.</a></form></div><img src="android%20-%20Load%20local%20html%20in%20WebView%20%20-%20Stack%20Overflow_files/i.gif" border="0" height="0px" width="0px"></div>
    <div id="hireme">
        <script type="text/javascript">
window.careers_adurl="http://careers.stackoverflow.com/gethired/js",window.careers_cssurl="//cdn-careers.sstatic.net/careers/gethired/sidebar.min.css?v=17be6ca0db4b",window.careers_leaderboardcssurl="//cdn-careers.sstatic.net/careers/gethired/ninja.min.css?v=78ccbfa5c59f",window.careers_companycssurl="//cdn-careers.sstatic.net/careers/gethired/company",window.careers_adselector="div.hireme, div#hireme",StackExchange.ready(function(){$.ajax({url:"//cdn-careers.sstatic.net/careers/gethired/loader.min.js?v=607ab2dda910",dataType:"script",cache:!0})})        </script>
    </div>



      
    
    <div class="module sidebar-linked">
        <h4 id="h-linked">Linked</h4>
        <div class="linked" data-tracker="lq=1">
            <div class="spacer">
<a href="http://stackoverflow.com/q/5749569?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">28</div>
</a>
<a href="http://stackoverflow.com/questions/5749569/load-local-html-file-into-webview?lq=1" class="question-hyperlink">Load local HTML file into WebView</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/1652850?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">28</div>
</a>
<a href="http://stackoverflow.com/questions/1652850/android-webview-cookie-problem?lq=1" class="question-hyperlink">Android WebView Cookie Problem</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/10780031?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/10780031/webview-save-html-file?lq=1" class="question-hyperlink">WebView Save HTML file</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/4659847?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">3</div>
</a>
<a href="http://stackoverflow.com/questions/4659847/how-to-play-swf-with-flash-player-lite-in-android-2-2-sdk-in-java?lq=1" class="question-hyperlink">How to play .swf with flash player lite in android 2.2 sdk in java?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/14244386?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/14244386/webview-loaddata-without-internet-connection?lq=1" class="question-hyperlink">webView loadData without internet connection</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/9958403?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/9958403/android-webview-can-show-google-com-but-not-localhost-whereas-iphone-uiwebview-c?lq=1" class="question-hyperlink">Android Webview can show google.com but not localhost whereas iPhone UIWebView can show localhost</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/14905359?lq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/14905359/how-to-display-the-httpresponse-page-in-an-android-activity?lq=1" class="question-hyperlink">How to display the HttpResponse page in an android activity</a>
</div>

        </div>
    </div>
    <div class="module sidebar-related">
        <h4 id="h-related">Related</h4>
        <div class="related" data-tracker="rq=1">
            <div class="spacer">
<a href="http://stackoverflow.com/q/5552578?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">2</div>
</a>
<a href="http://stackoverflow.com/questions/5552578/load-html-into-webview-in-android?rq=1" class="question-hyperlink">Load HTML into webview in Android?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/6416026?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">5</div>
</a>
<a href="http://stackoverflow.com/questions/6416026/unable-to-load-local-html-file-in-android-webview?rq=1" class="question-hyperlink">Unable to load local HTML file in Android WebView</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/7209994?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">2</div>
</a>
<a href="http://stackoverflow.com/questions/7209994/using-android-webview-to-load-external-html-with-local-resources-images-javasc?rq=1" class="question-hyperlink">Using Android WebView to load external HTML with local resources (images, javascript)?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/7895436?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/7895436/how-to-load-local-html-with-javascript-in-android-webview?rq=1" class="question-hyperlink">How to load local HTML with JavaScript in Android WebView?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/8681225?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">1</div>
</a>
<a href="http://stackoverflow.com/questions/8681225/android-improve-webview-speed-loading-local-html-files?rq=1" class="question-hyperlink">Android: Improve WebView speed loading local HTML files?</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/9922996?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/9922996/android-webview-loading-a-local-html-file-ignoring-its-body?rq=1" class="question-hyperlink">Android WebView: loading a local HTML file ignoring its body</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/11741815?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">-1</div>
</a>
<a href="http://stackoverflow.com/questions/11741815/load-local-html-in-webview-depending-on-language?rq=1" class="question-hyperlink">Load local html in webview depending on language</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/12383278?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">0</div>
</a>
<a href="http://stackoverflow.com/questions/12383278/loading-local-html-file-from-asset-folder-into-a-webview?rq=1" class="question-hyperlink">Loading local html file from asset folder into a webview</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/13494716?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes answered-accepted default">2</div>
</a>
<a href="http://stackoverflow.com/questions/13494716/capture-picture-from-webview-loading-local-html?rq=1" class="question-hyperlink">Capture picture from webview loading local html</a>
</div>
<div class="spacer">
<a href="http://stackoverflow.com/q/18172785?rq=1" title="Vote score (upvotes - downvotes)">
        <div class="answer-votes default">0</div>
</a>
<a href="http://stackoverflow.com/questions/18172785/loading-local-html-file-with-webview?rq=1" class="question-hyperlink">Loading local .HTML-file with WebView</a>
</div>

        </div>
    </div>
</div>

<div id="feed-link">
    <div id="feed-link-text"><a href="http://stackoverflow.com/feeds/question/4543349" title="feed of this question and its answers"><span class="feed-icon"></span>question feed</a></div>
</div>
<script type="text/javascript">
StackExchange.ready(function(){$.get('/posts/4543349/ivc/69fb');});
</script>
<noscript>
    <div><img src="/posts/4543349/ivc/69fb" class="dno" alt="" width="0" height="0"></div>
</noscript><div style="display:none" id="prettify-lang">default</div></div>


        </div>
    </div>
    <div id="footer" class="categories">
        <div class="footerwrap">
            <div id="footer-menu">
                <div class="top-footer-links">
                        <a href="http://stackoverflow.com/about">about</a>
                    <a href="http://stackoverflow.com/help">help</a>
                        <a href="http://stackoverflow.com/help/badges">badges</a>
                    <a href="http://blog.stackexchange.com/?blb=1">blog</a>
                        <a href="http://chat.stackoverflow.com/">chat</a>
                    <a href="http://data.stackexchange.com/">data</a>
                    <a href="http://stackexchange.com/legal">legal</a>
                    <a href="http://stackexchange.com/legal/privacy-policy">privacy policy</a>
                    <a href="http://stackexchange.com/about/hiring">jobs</a>
                    <a href="http://engine.adzerk.net/r?e=eyJhdiI6NDE0LCJhdCI6MjAsImNtIjo5NTQsImNoIjoxMTc4LCJjciI6Mjc3NiwiZG0iOjQsImZjIjoyODYyLCJmbCI6Mjc1MSwibnciOjIyLCJydiI6MCwicHIiOjExNSwic3QiOjAsInVyIjoiaHR0cDovL3N0YWNrb3ZlcmZsb3cuY29tL2Fib3V0L2NvbnRhY3QiLCJyZSI6MX0&amp;s=hRods5B22XvRBwWIwtIMekcyNF8">advertising info</a>

                    <a onclick='StackExchange.switchMobile("on", "/questions/4543349/load-local-html-in-webview")'>mobile</a>
                    <b><a href="http://stackoverflow.com/contact">contact us</a></b>
                        <b><a href="http://meta.stackoverflow.com/">feedback</a></b>
                    
                </div>
                <div id="footer-sites">
                    <table>
    <tbody><tr>
            <th colspan="3">
                Technology
            </th>
            <th>
                Life / Arts
            </th>
            <th>
                Culture / Recreation
            </th>
            <th>
                Science
            </th>
            <th>
                Other
            </th>
    </tr>
    <tr>
            <td>
                <ol>
                        <li><a href="http://stackoverflow.com/" title="professional and enthusiast programmers">Stack Overflow</a></li>
                        <li><a href="http://serverfault.com/" title="professional system and network administrators">Server Fault</a></li>
                        <li><a href="http://superuser.com/" title="computer enthusiasts and power users">Super User</a></li>
                        <li><a href="http://webapps.stackexchange.com/" title="power users of web applications">Web Applications</a></li>
                        <li><a href="http://askubuntu.com/" title="Ubuntu users and developers">Ask Ubuntu</a></li>
                        <li><a href="http://webmasters.stackexchange.com/" title="pro webmasters">Webmasters</a></li>
                        <li><a href="http://gamedev.stackexchange.com/" title="professional and independent game developers">Game Development</a></li>
                        <li><a href="http://tex.stackexchange.com/" title="users of TeX, LaTeX, ConTeXt, and related typesetting systems">TeX - LaTeX</a></li>
                            </ol></td><td><ol>
                        <li><a href="http://programmers.stackexchange.com/" title="professional programmers interested in conceptual questions about software development">Programmers</a></li>
                        <li><a href="http://unix.stackexchange.com/" title="users of Linux, FreeBSD and other Un*x-like operating systems.">Unix &amp; Linux</a></li>
                        <li><a href="http://apple.stackexchange.com/" title="power users of Apple hardware and software">Ask Different (Apple)</a></li>
                        <li><a href="http://wordpress.stackexchange.com/" title="WordPress developers and administrators">WordPress Answers</a></li>
                        <li><a href="http://gis.stackexchange.com/" title="cartographers, geographers and GIS professionals">Geographic Information Systems</a></li>
                        <li><a href="http://electronics.stackexchange.com/" title="electronics and electrical engineering professionals, students, and enthusiasts">Electrical Engineering</a></li>
                        <li><a href="http://android.stackexchange.com/" title="enthusiasts and power users of the Android operating system">Android Enthusiasts</a></li>
                        <li><a href="http://security.stackexchange.com/" title="IT security professionals">IT Security</a></li>
                            </ol></td><td><ol>
                        <li><a href="http://dba.stackexchange.com/" title="database professionals who wish to improve their database skills and learn from others in the community">Database Administrators</a></li>
                        <li><a href="http://drupal.stackexchange.com/" title="Drupal developers and administrators">Drupal Answers</a></li>
                        <li><a href="http://sharepoint.stackexchange.com/" title="SharePoint enthusiasts">SharePoint</a></li>
                        <li><a href="http://ux.stackexchange.com/" title="user experience researchers and experts">User Experience</a></li>
                        <li><a href="http://mathematica.stackexchange.com/" title="users of Mathematica">Mathematica</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#technology" class="more">
                                more (13)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://photo.stackexchange.com/" title="professional, enthusiast and amateur photographers">Photography</a></li>
                        <li><a href="http://scifi.stackexchange.com/" title="science fiction and fantasy enthusiasts">Science Fiction &amp; Fantasy</a></li>
                        <li><a href="http://cooking.stackexchange.com/" title="professional and amateur chefs">Seasoned Advice (cooking)</a></li>
                        <li><a href="http://diy.stackexchange.com/" title="contractors and serious DIYers">Home Improvement</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#lifearts" class="more">
                                more (13)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://english.stackexchange.com/" title="linguists, etymologists, and serious English language enthusiasts">English Language &amp; Usage</a></li>
                        <li><a href="http://skeptics.stackexchange.com/" title="scientific skepticism">Skeptics</a></li>
                        <li><a href="http://judaism.stackexchange.com/" title="those who base their lives on Jewish law and tradition and anyone interested in learning more">Mi Yodeya (Judaism)</a></li>
                        <li><a href="http://travel.stackexchange.com/" title="road warriors and seasoned travelers">Travel</a></li>
                        <li><a href="http://christianity.stackexchange.com/" title="committed Christians, experts in Christianity and those interested in learning more">Christianity</a></li>
                        <li><a href="http://gaming.stackexchange.com/" title="passionate videogamers on all platforms">Arqade (gaming)</a></li>
                        <li><a href="http://bicycles.stackexchange.com/" title="people who build and repair bicycles, people who train cycling, or commute on bicycles">Bicycles</a></li>
                        <li><a href="http://rpg.stackexchange.com/" title="gamemasters and players of tabletop, paper-and-pencil role-playing games">Role-playing Games</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#culturerecreation" class="more">
                                more (21)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://math.stackexchange.com/" title="people studying math at any level and professionals in related fields">Mathematics</a></li>
                        <li><a href="http://stats.stackexchange.com/" title="statisticians, data analysts, data miners and data visualization experts">Cross Validated (stats)</a></li>
                        <li><a href="http://cstheory.stackexchange.com/" title="theoretical computer scientists and researchers in related fields">Theoretical Computer Science</a></li>
                        <li><a href="http://physics.stackexchange.com/" title="active researchers, academics and students of physics">Physics</a></li>
                        <li><a href="http://mathoverflow.net/" title="professional mathematicians">MathOverflow</a></li>
                    
                        <li>
                            <a href="http://stackexchange.com/sites#science" class="more">
                                more (7)
                            </a>
                        </li>
                </ol>
            </td>
            <td>
                <ol>
                        <li><a href="http://stackapps.com/" title="apps, scripts, and development with the Stack Exchange API">Stack Apps</a></li>
                        <li><a href="http://meta.stackoverflow.com/" title="meta-discussion of the Stack Exchange family of Q&amp;A websites">Meta Stack Overflow</a></li>
                        <li><a href="http://area51.stackexchange.com/" title="proposing new sites in the Stack Exchange network">Area 51</a></li>
                        <li><a href="http://careers.stackoverflow.com/">Stack Overflow Careers</a></li>
                    
                </ol>
            </td>
    </tr>
</tbody></table>
                </div>
            </div>

            <div id="copyright">
                site design / logo © 2013 stack exchange inc; 
                user contributions licensed under <a href="http://creativecommons.org/licenses/by-sa/3.0/" rel="license">cc-wiki</a> 
                with <a href="http://blog.stackoverflow.com/2009/06/attribution-required/" rel="license">attribution required</a>
            </div>
            <div id="footer-flair">
                <a href="http://creativecommons.org/licenses/by-sa/3.0/" class="cc-wiki-link"></a>
            </div>
            <div id="svnrev">
                rev 2013.8.26.972
            </div>
            
        </div>
    </div>
    <noscript>
        <div id="noscript-warning">Stack Overflow works best with JavaScript enabled<img src="http://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif" alt="" class="dno"></div>
    </noscript>

    <script type="text/javascript">var _gaq=_gaq||[];_gaq.push(['_setAccount','UA-5620270-1']);
        _gaq.push(['_setCustomVar', 1, 'tags', '|android|webview|']); 
_gaq.push(['_trackPageview']);
    var _qevents = _qevents || [];
    (function () {
        var ssl='https:'==document.location.protocol,
            s=document.getElementsByTagName('script')[0],
            ga=document.createElement('script');
        ga.type='text/javascript';
        ga.async=true;
        ga.src=(ssl?'https://ssl':'http://www')+'.google-analytics.com/ga.js';
        s.parentNode.insertBefore(ga,s);
        var sc=document.createElement('script');
        sc.type='text/javascript';
        sc.async=true;
        sc.src=(ssl?'https://secure':'http://edge')+'.quantserve.com/quant.js';
        s.parentNode.insertBefore(sc,s);
    })();
    _qevents.push({ qacct: "p-c1rF4kxgLUzNc" });
    </script>        
    

</body></html>